package csv2db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.mysql.jdbc.Statement;

public class GetSqlData {
	
	protected Connection con;
	protected String url;
	protected String username;
	protected String password;
	protected String driver;
	
	public GetSqlData(){
		
		con = null;
	    url = "jdbc:mysql://localhost/database_files";
	    username = "root";
	    password = "";
	    driver = "com.mysql.jdbc.Driver";
		
	}
	
	public void getData(){
		
		Statement stmt;
		ResultSet rs;
		
		try{
			Class.forName(driver).newInstance();
			con = DriverManager.getConnection(url, username, password);
			try{
				stmt = (Statement) con.createStatement();
				rs = stmt.executeQuery("");
				System.out.println("Tabella cancellata con successo");                            
	         } catch(SQLException s){
	        	 System.out.println("La tabella non e` stata cancellata");               
	        	// s.printStackTrace();
	         }
	            con.close();
	            
		}catch (Exception e){
			e.printStackTrace();		
		}
	}
}
